/*
 * @Author: kanglang
 * @Date: 2020-11-23 11:38:07
 * @LastEditors: kanglang
 * @LastEditTime: 2021-05-19 13:57:46
 * @Description: 返回按钮
 */
import React, { Fragment } from 'react';
import { StyleSheet, Image, Text, View, TouchableOpacity } from 'react-native';
import { _, msg } from '@/common';
import { px2dp, isAndroid } from '@/styles';
import { iconLeft } from '@/images';

const Back = ({ goBack }) => {

  const back = () => {
    !!goBack ? goBack() : msg.emit('router: back');
  }
  return (
    <TouchableOpacity
      style={styles.backDot}
      onPress={back}>
      <Image
        style={styles.backImg}
        resizeMode="stretch"
        source={iconLeft}
      />
    </TouchableOpacity >
  );
}
export default Back;

const styles = StyleSheet.create({
  backDot: {
    width: px2dp(66),
    height: px2dp(66),
    backgroundColor: 'rgba(52,51,50,1)',
    position: 'absolute',
    left: px2dp(40),
    ..._.ifIphoneX({ top: px2dp(100) }, isAndroid ? { top: px2dp(40) } : { top: px2dp(70) }),
    backgroundColor: '#343332',
    opacity: 0.4,
    borderRadius: px2dp(33),
    justifyContent: 'center',
    alignItems: 'center',
    zIndex: 2
  },
  backImg: {
    width: px2dp(36),
    height: px2dp(36),
  },

});
